home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / System Software / U.S. System Software / System 7 Pro™ Beta 11 / Development Tools / Sample Code / Standard Mail / MiniMailer / Src / MiniMailer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-16  |  4.7 KB  |  210 lines  |  [TEXT/KAHL]

  1. /*                                MiniMailer.h                            */
  2. /*
  3.  * MiniMailer is an extremely simple mailer demo that allows you to
  4.  * send a TEXT file to a remote address. That's all it does. This
  5.  * demo is only intended to let you gain initial familiarity with
  6.  * the mailer; that's all it does. It is *not* a "real" application.
  7.  *
  8.  * The only, repeat, only intent of this demo is to show you the
  9.  * simplest-possible interaction with the standard mailer. See
  10.  * CollabDraw for a more extensive real-world application.
  11.  *
  12.  * Oh, it has one other purpose: because it is so small, it can
  13.  * act as a test-bed for exploring some parts of the mailer.
  14.  *
  15.  * Author: Martin Minow, MACDTS.
  16.  * AppleLink:    DEVSUPPORT
  17.  *
  18.  * Copyright © 1992-93, Apple Computer Inc. All Rights Reserved.
  19.  */
  20.  
  21. /*
  22.  * Menu organization
  23.  */
  24. #define MBAR_MenuBar    1
  25. #define MENU_Apple        1
  26. #define MENU_File        256
  27. #define MENU_Edit        257
  28. #define ALRT_Error        9000
  29.  
  30.  
  31. #ifndef REZ
  32. /*
  33.  * The rest of this file is unusable by Rez
  34.  */
  35. #include <Processes.h>
  36. #include <Errors.h>
  37. #include <Finder.h>
  38. #include <Folders.h>
  39. #include <Script.h>
  40. #include <Types.h>
  41. #include <Resources.h>
  42. #include <QuickDraw.h>
  43. #include <Fonts.h>
  44. #include <Events.h>
  45. #include <Windows.h>
  46. #include <Menus.h>
  47. #include <TextEdit.h>
  48. #include <Dialogs.h>
  49. #include <Desk.h>
  50. #include <ToolUtils.h>
  51. #include <Memory.h>
  52. #include <Files.h>
  53. #include <OSUtils.h>
  54. #include <OSEvents.h>
  55. #include <DiskInit.h>
  56. #include <Packages.h>
  57. #include <Traps.h>
  58. #include <Lists.h>
  59. #include <GestaltEqu.h>
  60. #include <OCE.h>
  61. #include <OCEAuthDir.h>
  62. #include <OCEStandardDirectory.h>
  63. #include <OCEStandardMail.h>
  64. #include <OCEStandardDirectory.h>
  65. #include <OCEErrors.h>
  66. #ifndef EXTERN
  67. #define EXTERN        extern
  68. #endif
  69.  
  70. #ifndef TRUE
  71. #define TRUE        1
  72. #define FALSE        0
  73. #endif
  74. #ifdef kSDPInstallPanelBusyProc            /* TEMP    #ifdef        */
  75. #define OCE_Beta2 TRUE
  76. #else
  77. #define OCE_Beta2 FALSE
  78. #endif
  79.  
  80. /*
  81.  * Menu options.
  82.  */
  83. enum {
  84.     kAppleAbout        = 1
  85. };
  86. enum {
  87.     kFileSend        = 1,
  88.     kFileUnused1,
  89.     kFileTestGetListItemInfo,
  90.     kFileTestAddAttachment,
  91.     kFileUnused2,
  92.     kFileTestNoTarget,
  93.     kFileTestBecomeTarget,
  94.     kFileUnused3,
  95.     kFileQuit,
  96.     kFileForceQuit
  97. };
  98. enum {
  99.     kEditUndo        = 1,
  100.     kEditCut        = 3,
  101.     kEditCopy        = 4,
  102.     kEditPaste        = 5,
  103.     kEditClear        = 6
  104. };
  105.  
  106. #define kScrollBarSize    16
  107.  
  108. EXTERN MenuHandle            gAppleMenu;
  109. EXTERN MenuHandle            gFileMenu;
  110. EXTERN MenuHandle            gEditMenu;
  111.  
  112. EXTERN EventRecord            gEventRecord;
  113. EXTERN WindowPtr            gMailerWindow;
  114. EXTERN OSErr                gStatus;
  115. EXTERN SMPMailerResult        gWhatHappened;
  116. EXTERN SMPMailerState        gMailerState;
  117. EXTERN SMPMailerComponent    gLastTargetComponent;
  118. EXTERN short                gMailerChangeCount;
  119. EXTERN Boolean                gQuitNow;
  120. EXTERN Str255                gMailDocumentTitle;
  121. EXTERN Boolean                gMessageHasDestination;
  122. EXTERN Boolean                gCopyInProgress;
  123. EXTERN Boolean                gHasAOCEToolbox;
  124. EXTERN Boolean                gHasColorQuickDraw;
  125.  
  126. /*
  127.  * gMailerState is used to handle the Edit menu.
  128.  * the gMailerEditCommands vector changes the
  129.  * menu item to the editor command value.
  130.  */
  131. EXTERN SMPMailerState        gMailerState;
  132. extern const SMPEditCommand    gMailerEditCommands[];
  133.  
  134. /*
  135.  * For SendMailMessage()
  136.  */
  137. EXTERN SMPSendFormat        gSendFormat;
  138. #if OCE_Beta2
  139. EXTERN SMPSendOptions        gSendOptions;
  140. #else
  141. EXTERN SMPSendOptionsHandle    gSendOptions;
  142. #endif
  143. EXTERN Boolean                gMustAddContent;
  144.  
  145. /*
  146.  * For SDPPromptForIdentity
  147.  */
  148. EXTERN AuthIdentity            gUserIdentity;
  149.  
  150. /*
  151.  * For the file I/O
  152.  */
  153. EXTERN short                gFileRefNum;        /* Open file ID            */
  154. EXTERN Ptr                    gFileDataBuffer;    /* Data read here        */
  155. EXTERN long                    gFileByteCount;        /* Bytes read from file    */
  156. EXTERN Boolean                gFileAtEOF;            /* TRUE at end of file    */
  157. #define kFileReadSize        4096                /* Amount to read        */
  158.  
  159. void                main(void);
  160. void                DoApplicationEvent(void);
  161. void                DoActivateEvent(
  162.         WindowPtr        theWindow,
  163.         Boolean            isActivate
  164.     );
  165. void                DoUpdateEvent(void);
  166. void                DoKeyDownEvent(void);
  167. void                DoApplicationMouseEvent(void);
  168. void                DoMenuCommand(
  169.         long            menuChoice
  170.     );
  171. void                AdjustMenus(
  172.         Boolean            isDeskAccessory
  173.     );
  174. void                FixEditMenu(
  175.         short            menuItem,
  176.         Boolean            enableIt
  177.     );
  178. void                InitializeAppleEvents(void);
  179. void                DoHighLevelEvent(void);
  180. void                InitializeMacintosh(void);
  181. void                InitializeMailer(void);
  182. void                BuildMailerWindow(void);
  183. void                TestGetListItemInfo(void);
  184. void                TestAddAttachment(void);
  185. void                CheckForDestination(void);
  186. void                SendMailMessage(void);
  187. Boolean                SendThisFile(void);
  188. Boolean                GetFileToSend(void);
  189. void                ReadDataFromFile(void);
  190. void                CloseDataFile(void);
  191. void                ErrorAlert(
  192.         OSErr            status,
  193.         StringPtr        messageText
  194.     );
  195. OSErr                GetUserIdentity(
  196.         AuthIdentity    *userIdentity
  197.     );
  198. OSErr                SystemSupportsAOCE(void);
  199.  
  200. /*
  201.  * Cheap 'n dirty pascal string copy routine.
  202.  */
  203. #define pstrcpy(dst, src) do {                            \
  204.         StringPtr    _src = (src);                        \
  205.         BlockMove(_src, dst, _src[0] + 1);                \
  206.     } while (0)
  207.  
  208. #endif /* If compiling code */
  209.  
  210.